-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefix GVK labels in CustomResourceMonitoring #1942
prefix GVK labels in CustomResourceMonitoring #1942
Conversation
@bavarianbidi: This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I think "group" is fine and it aligns with k8s documentations, cc @rexagod to have another review. |
I am a bit on the fence here as I like the current naming because it aligns with the labels we have in the kube-apiserver HTTP metrics. But at the same time I can see how one could want to use a version label for other purposes. Maybe we could prefix them with Do you have an opinion on that @logicalhan? |
Don't get me wrong, because it's really nice to get the As an alternative we could also think about an additional configuration value/flag where a user can opt-in/opt-out the auto-generated Beside the origin issue with the from
from
|
Yeah this scenario totally makes sense.
I wouldn't be in favor of that since I don't think that there are any advantages to removing the GVK labels since they provide key information for barely any overhead. |
docs/customresourcestate-metrics.md
Outdated
@@ -49,7 +49,7 @@ spec: | |||
- --resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,foos,horizontalpodautoscalers,ingresses,jobs,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments,verticalpodautoscalers | |||
``` | |||
|
|||
NOTE: The `group`, `version`, and `kind` common labels are reserved, and will be overwritten by the values from the `groupVersionKind` field. | |||
NOTE: The `cr_group`, `cr_version`, and `cr_kind` common labels are reserved, and will be overwritten by the values from the `groupVersionKind` field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we had some consistency between this prefix and the one in the metric name. Currently the metric name is using the crd
prefix which might not be well suited. Might be better to go with kube_cr
or kube_custom_resources
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean we should use the future prefix in the metric name and in the label itself?
I like kube_custom_resource
more than kube_cr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'd like to avoid having crd
somewhere and cr
elsewhere, it's better be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, would be nice to have one thing. I believe right now we mix Custom Resource, Custom Resource Definition and Custom Resource State. kube_customresource
would align with kube_horizontalpodautoscaler
(no additional underscores).
Should we rename everything custom resource state into simply custom resource and abbreviate it with "cr" where necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've pushed a new commit (ed85920) - this should reflect the way we want to go further
rebased and squashed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Based on the previous commit i started to improve the unit-tests because they didn't cover the default generated group
,version
,kind
labels atm. will continue on monday morning.
Another way might be kube-state-metrics to support renaming labels for CRs.
|
This will prefix the auto-generated GVK labels for CustomResources with customresource_ to make it a bit more clear that these labels got generated. Signed-off-by: Mario Constanti <mario@constanti.de>
ed85920
to
7130bd0
Compare
Help: "metrics for testing", | ||
Each: &compiledInfo{}, | ||
Labels: map[string]string{ | ||
"customresource_group": "apps", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
customresource_group to cr_group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comming from this comment
I agree, would be nice to have one thing. I believe right now we mix Custom Resource, Custom Resource Definition and Custom Resource State.
kube_customresource
would align withkube_horizontalpodautoscaler
(no additional underscores).Should we rename everything custom resource state into simply custom resource and abbreviate it with "cr" where necessary?
i've started with customresource
(because i like it a bit more) but as i'm not very opinionated i'm also fine to switch to cr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @mrueg which label name do you prefer? cr_group
or customresource_group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal preference is the second one, two letter acronyms can become ambiguous
Signed-off-by: Mario Constanti <mario@constanti.de>
cfb26ce
to
b410166
Compare
/approve Thanks for your contribution! |
/approve |
I've got 2 approvals... Who could give an LGTM to get this merged? |
I'll make sure to merge it by the end of this week, want to provide other maintainers the opportunity to give further feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for bearing with us @bavarianbidi :)
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bavarianbidi, dgrisonnet, mrueg, rexagod The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Mario Constanti mario@constanti.de
What this PR does / why we need it:
This PR will prefix the auto-generated GVK labels for CustomResources with
cr_
to make it a bit more clear that these labels got generated.It also make it more easier to reflect e.g. a
version
of aCR
in a metric by just label itversion
instead of some specificapp_version
(or similar).How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #